<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Deflate a string</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.gzdeflate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">gzdeflate</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">gzdeflate</span> &mdash; <span class="dc-title">Deflate a string</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.gzdeflate-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>gzdeflate</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$level</code><span class="initializer"> = -1</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$encoding</code><span class="initializer"> = ZLIB_ENCODING_RAW</span></span>
  ]] ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   This function compresses the given string using the <em>DEFLATE</em>
   data format.
  </p>
  <p class="para">
   For details on the DEFLATE compression algorithm see the document
   &quot;<a href="http://www.faqs.org/rfcs/rfc1951" class="link external">&raquo;&nbsp;DEFLATE Compressed Data Format
   Specification version 1.3</a>&quot; (RFC 1951).
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.gzdeflate-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">data</code></dt>

     <dd>

      <p class="para">
       The data to deflate.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">level</code></dt>

     <dd>

      <p class="para">
       The level of compression. Can be given as 0 for no compression up to 9
       for maximum compression. If not given, the default compression level will
       be the default compression level of the zlib library.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">encoding</code></dt>

     <dd>

      <p class="para">
       One of <strong><code>ZLIB_ENCODING_*</code></strong> constants.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.gzdeflate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The deflated string or <strong><code>FALSE</code></strong> if an error occurred.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.gzdeflate-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-870">
    <p><strong>Example #1 <span class="function"><strong>gzdeflate()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$compressed&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">gzdeflate</span><span style="color: #007700">(</span><span style="color: #DD0000">'Compress&nbsp;me'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">9</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$compressed</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.gzdeflate-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.4.0</td>
       <td>
        Added <code class="parameter">encoding</code> parameter.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.gzdeflate-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="gzinflate.html" class="function" rel="rdfs-seeAlso">gzinflate()</a> - Inflate a deflated string</span></li>
    <li class="member"><span class="function"><a href="gzcompress.html" class="function" rel="rdfs-seeAlso">gzcompress()</a> - Compress a string</span></li>
    <li class="member"><span class="function"><a href="gzuncompress.html" class="function" rel="rdfs-seeAlso">gzuncompress()</a> - Uncompress a compressed string</span></li>
    <li class="member"><span class="function"><a href="gzencode.html" class="function" rel="rdfs-seeAlso">gzencode()</a> - Create a gzip compressed string</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>